/**
 * @author shikundai
 * @date 2020/12/10
 * @time 11:50
 * @description  相关的公共的js操作需要提前引入JQuery和Layui和vue  axios
 */

/**
 * 描述：
 * @author shikundai
 * @date 2020/12/10
 * @time 15:14 layui相关模块的引入
 */
var layer;
layui.use(['layer'], function () {
    layer = layui.layer;

});

/**
 * 描述：页面加载完执行的相关操作
 * @author shikundai
 * @date 2020/12/10
 * @time 15:03
 */
$(function () {
    /**
     * 描述：顶部导航栏的vue参数绑定
     * @author shikundai
     * @date 2020/12/10
     * @time 14:49
     */
    var topVm = new Vue({
        el: "header",
        data: {
            consignees: "",
            customerInfo: "Hello",
            customerLogin: ""
        },
        mounted: function () {
            axios
                .get('../customer/isLogin')
                .then(response => (
                this.consignees = response.data.data.consignees,
                    this.customerInfo = response.data.data.customerInfo,
                    this.customerLogin = response.data.data.customerLogin)
        ).
            catch(function (error) { // 请求失败处理
                console.log(error);
            });
        }
        , methods: {}
    });


    
});

/**
 * @author shikundai
 * @date 2020/12/9
 * @time 11:29
 * @description 用户登出操作
 */
function logOut() {
    $.get("../customer/logOut", function (res) {
        if (res.code == 20) {
            window.location.href = "../home/index.html";
        } else {
            layer.msg(res.msg);
        }
    });
}


